package com.java.controller.admin;

import com.github.pagehelper.PageInfo;
import com.java.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/admin")
public class AdminController {
    @Autowired
    private UserService userService;

    @RequestMapping("/test")
    public @ResponseBody String test(){
        return "hello ssm";
    }

    @RequestMapping("/getuser")
    public @ResponseBody List<Map<String,Object>> getuser(Integer pageNum, Integer pageSize){
        List<Map<String,Object>> userList = userService.finduser(pageNum,pageSize);
        PageInfo<Map<String,Object>> pageInfo = new PageInfo<>(userList);
        return pageInfo.getList();
    }
}
